package com.flurry.android;

import android.util.Log;
import com.flurry.android.responses.AppCloudError;
import com.flurry.android.responses.AppCloudLoginResponseHandler;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

final class dg
  implements AppCloudResponseHandler
{
  dg(String paramString, AppCloudLoginResponseHandler paramAppCloudLoginResponseHandler)
  {
  }

  public final void handleResponse(AppCloudResponse paramAppCloudResponse)
    throws Exception
  {
    if (paramAppCloudResponse != null)
      try
      {
        if (paramAppCloudResponse.isSuccessful())
        {
          JSONObject localJSONObject = paramAppCloudResponse.bY.getJSONArray("set").getJSONObject(0);
          AppCloudUser localAppCloudUser = new AppCloudUser(localJSONObject);
          paramAppCloudResponse.bX = localAppCloudUser;
          Log.d("Trestle", "Login user" + paramAppCloudResponse.toString());
          AppCloudUser.setCurrentUser(localAppCloudUser);
          String str1 = localJSONObject.getString("_id");
          String str2 = localJSONObject.getString("username");
          String str3 = localJSONObject.getString("email");
          String str4 = paramAppCloudResponse.bY.getString("APPCLOUD_USER_SESSION");
          et.z(str1);
          et.d(str2, str3, str4);
          et.A(this.fh);
          this.fe.onOperationSucceed(localAppCloudUser);
          return;
        }
        this.fe.onError(new AppCloudError(paramAppCloudResponse.getHTTPResponseCode(), paramAppCloudResponse.getResponseMessage()));
        Log.d("Trestle", "Login Fail: " + paramAppCloudResponse.getResponseMessage().toString());
        return;
      }
      catch (JSONException localJSONException)
      {
        localJSONException.printStackTrace();
        return;
      }
    this.fe.onError(new AppCloudError(400, "Bad response"));
  }
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     com.flurry.android.dg
 * JD-Core Version:    0.6.2
 */